package org.yefei.homeworkday12;

public class Car {
	/*
	 * 1:汽车由发动机，轮胎，车架，底盘组成， 有外观，价格等属性 有启动，停止，鸣笛等方法 发动机有排量，重量，品牌，马力等属性，功能有
	 * 压缩空气，雾化汽油，点火，排废烟 汽车启动 由 发动机完成，分为 压缩空气，雾化汽油，点火，排废烟 四部完成。
	 * 用oo的思想模拟实现这个过程（其他属性用String定义）。
	 */
	String appearance;
	double price;
	String comprise;
	Engine engine;

	public void showInfo() {
		System.out.println("汽车的组成：" + comprise + ";外观：" + appearance + ";价格是" + price + "万元");
		engine.showInfo();
	}

	public void start() {
		System.out.println("启动：");
		engine.compressedAir();
		engine.atomizedGas();
		engine.ignition();
		engine.exhaustSmoke();
	}

	public void stop() {
		System.out.println("停车！");
	}

	public void blow() {
		System.out.println("滴滴！");
	}

	public static void main(String[] args) {
		Car car = new Car();
		car.appearance = "白色";
		car.price = 30.5;
		car.comprise = "发动机、轮胎、车架、底盘";

		Engine en = new Engine();
		en.brand = "丰田";
		en.weight = "0.5吨";
		en.displacement = "3.0T";
		en.horsepower = "405马力";

		car.engine = en;

		car.showInfo();
		System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
		car.start();
		System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
		car.blow();
		System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
		car.stop();
	}
}
